Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

multicast-dns

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multicast-dns

Low level multicast-dns implementation in pure javascript

  • 7.2.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12M
increased by5.9%
Maintainers
2
Weekly downloads
 
Created

What is multicast-dns?

The multicast-dns npm package allows for low-level network discovery and communication using multicast DNS, which is often used in zero-configuration networking to resolve hostnames to IP addresses within small networks that do not include a local name server.

What are multicast-dns's main functionalities?

Discover services on the local network

This code sets up a multicast DNS instance to listen for responses to queries on the local network. It then sends out a query for the A (address) record for 'brunhilde.local'.

const mdns = require('multicast-dns')();

mdns.on('response', function(response) {
  console.log('Got a response to an mDNS query:', response)
});

mdns.query({
  questions:[{
    name: 'brunhilde.local',
    type: 'A'
  }]
});

Advertise services on the local network

This code listens for mDNS queries and responds with the IP address '192.168.1.5' when a query for 'brunhilde.local' is received.

const mdns = require('multicast-dns')();

mdns.on('query', function(query) {
  if (query.questions[0] && query.questions[0].name === 'brunhilde.local') {
    mdns.respond({
      answers: [{
        name: 'brunhilde.local',
        type: 'A',
        ttl: 300,
        data: '192.168.1.5'
      }]
    })
  }
});

Other packages similar to multicast-dns

Keywords

FAQs

Package last updated on 16 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc